"""
编辑线索页面
"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
from selenium.webdriver.support.select import Select

class EditCluePage(BasePage):
    #定位器
    #线索负责人
    xs_bjxs_xsfzr_locator = (By.ID, "owner_name")
    #来源
    xs_bjxs_ly_locator = (By.ID, "source")
    #职位
    xs_bjxs_zw_locator = (By.ID, "position")
    #手机
    xs_bjxs_sj_locator = (By.ID, "mobile")
    #省份
    xs_bjxs_sf_locator = (By.NAME, "address['state']")
    #城市
    xs_bjxs_cs_locator = (By.NAME, "address['city']")
    #地区
    xs_bjxs_dq_locator = (By.NAME, "address['area']")
    #街道
    xs_bjxs_jd_locator = (By.NAME, "address['street']")
    #下次联系时间
    xs_bjxs_xclxsj_locator = (By.ID, "nextstep_time")
    #公司名
    xs_bjxs_gsm_locator = (By.ID, "name")
    #联系人姓名
    xs_bjxs_lxrxm_locator = (By.ID, "contacts_name")
    #尊称
    xs_bjxs_zc_locator = (By.ID, "saltname")
    #邮箱
    xs_bjxs_yx_locator = (By.ID, "email")
    #下次联系内容
    xs_bjxs_xclxnr_locator = (By.ID, "nextstep")
    #备注
    xs_bjxs_bz_locator = (By.ID, "description")
    #保存
    xs_bjxs_bc_locator = (By.CSS_SELECTOR, "#form1 > table > tfoot > tr > td:nth-child(2) > input.btn.btn-primary")
    #空白地
    xs_bjxs_kb_locator = (By.CSS_SELECTOR, "#form1 > table > tbody > tr:nth-child(7) > td:nth-child(3)")


    #输入线索负责人
    def input_xsfzr(self,xsfzr):
        self.driver.find_element(*self.xs_bjxs_xsfzr_locator).clear()
        self.driver.find_element(*self.xs_bjxs_xsfzr_locator).send_keys(xsfzr)

    #选择来源
    def choose_ly(self,index):
        source = self.driver.find_element(*self.xs_bjxs_ly_locator)
        Select(source).select_by_index(index)
    #输入职位
    def input_zw(self,zw):
        self.driver.find_element(*self.xs_bjxs_zw_locator).clear()
        self.driver.find_element(*self.xs_bjxs_zw_locator).send_keys(zw)

    #输入手机
    def input_sj(self,sj):
        self.driver.find_element(*self.xs_bjxs_sj_locator).clear()
        self.driver.find_element(*self.xs_bjxs_sj_locator).send_keys(sj)

    #选择省份
    def choose_sf(self,index):
        source = self.driver.find_element(*self.xs_bjxs_sf_locator)
        Select(source).select_by_index(index)

    #选择城市
    def choose_cs(self,index):
        source = self.driver.find_element(*self.xs_bjxs_cs_locator)
        Select(source).select_by_index(index)
    #选择地区
    def choose_dq(self,index):
        source = self.driver.find_element(*self.xs_bjxs_dq_locator)
        Select(source).select_by_index(index)

    #输入街道
    def input_jd(self,jd):
        self.driver.find_element(*self.xs_bjxs_jd_locator).clear()
        self.driver.find_element(*self.xs_bjxs_jd_locator).send_keys(jd)

    #输入下次联系时间
    def input_xclxsj(self,xclxsj):
        self.driver.find_element(*self.xs_bjxs_xclxsj_locator).clear()
        self.driver.find_element(*self.xs_bjxs_xclxsj_locator).send_keys(xclxsj)

    #输入公司名
    def input_gsm(self,gsm):
        self.driver.find_element(*self.xs_bjxs_gsm_locator).clear()
        self.driver.find_element(*self.xs_bjxs_gsm_locator).send_keys(gsm)

    #输入联系人姓名
    def input_lxrxm(self,lxrxm):
        self.driver.find_element(*self.xs_bjxs_lxrxm_locator).clear()
        self.driver.find_element(*self.xs_bjxs_lxrxm_locator).send_keys(lxrxm)

    #选择尊称
    def choose_zc(self,index):
        source = self.driver.find_element(*self.xs_bjxs_zc_locator)
        Select(source).select_by_index(index)

    #输入邮箱
    def input_yx(self,yx):
        self.driver.find_element(*self.xs_bjxs_yx_locator).clear()
        self.driver.find_element(*self.xs_bjxs_yx_locator).send_keys(yx)

    #输入下次联系内容
    def input_xclxnr(self,xclxnr):
        self.driver.find_element(*self.xs_bjxs_xclxnr_locator).clear()
        self.driver.find_element(*self.xs_bjxs_xclxnr_locator).send_keys(xclxnr)

    #输入备注
    def input_bz(self,bz):
        self.driver.find_element(*self.xs_bjxs_bz_locator).clear()
        self.driver.find_element(*self.xs_bjxs_bz_locator).send_keys(bz)

    #点击空白处
    def click_kb(self):
        self.driver.find_element(*self.xs_bjxs_kb_locator).click()

    #点击保存
    def click_bc(self):
        self.driver.find_element(*self.xs_bjxs_bc_locator).click()